<?php
	/**
     +=========================================================
     * 广告系统
     * @package Adlist
     +=========================================================
     * @copyright © 2011 nickdraw.com All rights reserved.
     * @author NickDraw(零度温柔) webmaster@206c.net
     * @license http://www.nickdraw.com/license
     * @version V1.2
     +=========================================================
     */
	class AdlistAction extends CommonAction {
		function _filter(&$map){
			if (!isset($_GET['type'])){
				$type = 'index_banner';
			}else{
				$type = $_GET['type'];
			}
            $map['type'] = array('eq', $type);
        }
		
		
        public function _before_index(){
            if (isset($_GET['type']) && $_GET['type'] == 'about'){
                $model = D('adlist');
                $about = $model->where("type='index_about'")->find();
                if (empty($about)){
                    $insert['type'] = 'index_about';
                    $model->add($insert);
                }
                
                $this->assign("about",$about);
            }
        }
        
        public function aboutsave(){
        	$model = D('adlist');
        	if ($model->where("type='index_about'")->save($_POST)){
        		$this->assign("jumpUrl", U("index",array('tag'=>$_POST['tag'],'type'=>'about')));
        		$this->success('修改成功');
        	}else{
        		$this->error('修改失败');
        	}
        }
        
	}
